// pages/workbench/workbench.ts
Page({
  /**
   * 页面的初始数据
   */
  data: {
    list: [
      {
        title: "工单与调度管理",
        image: "../../assets/images/圆角矩形.png",
        item: [
          {
            image: "../../assets/job/工单管理.png",
            title: "工单管理",
            url: "/pages/order/order",
          },
          {
            image: "../../assets/job/调度任务审批.png",
            title: "工单统计",
            url: "/subpackagesA/pages/orderStatistics/orderStatistics",
          },
          {
            image: "../../assets/job/调度任务管理.png",
            title: "调度任务管理",
            url: "/subpackagesA/pages/statistics/statistics",
          },
          {
            image: "../../assets/job/调度任务执行.png",
            title: "调度任务执行",
          },
        ],
      },
      {
        title: "运行数据",
        image: "../../assets/images/圆角矩形.png",
        item: [
          {
            image: "../../assets/job/热源站.png",
            title: "热源站",
            url: "/subpackagesA/pages/heatsource/heatsource",
          },
          {
            image: "../../assets/job/换热站.png",
            title: "换热站",
            url: "/subpackagesA/pages/heatexchangestation/heatexchangestation",
          },
          {
            image: "../../assets/job/报警信息.png",
            title: "报警信息",
            url: "/subpackagesA/pages/alarminfo/alarminfo",
          },
          {
            image: "../../assets/job/热计量.png",
            title: "热计量",
            url: "/subpackagesA/pages/heatmeasure/heatmeasure",
          },
          {
						image: "../../assets/job/热计量监测.png",
						title: "热计量监测",
						url: "/subpackagesA/pages/ThermometricMonitoring/ThermometricMonitoring",
          },
          {
						image: "../../assets/job/每日报表.png",
						title: "每日报表",
						url: "/subpackagesA/pages/dailyReport/dailyReport",
					},
        ],
      },
      {
        title: "设备与巡检",
        image: "../../assets/images/圆角矩形.png",
        item: [
          {
            image: "../../assets/job/巡检.png",
            title: "巡检",
            // url:'/subpackagesA/pages/signin/signin'
            url: "/pages/signin-separate/signin-separate",
          },
          {
            image: "../../assets/job/设备台账管理.png",
            title: "设备台账管理",
            url:"/subpackagesA/pages/equipmentLedger/equipmentLedger"
          },
          {
            image: "../../assets/job/设备维护.png",
            title: "设备维护",
          },
          {
            image: "../../assets/job/消息.png",
            title: "消息",
            url: "/pages/information/information",
          },
        ],
      },
    ],
    comID: "",
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad() {},
  onSkip(e: any) {
    const { url,title } = e.currentTarget.dataset;
    const comID = wx.getStorageSync("userInfo").data.comID;
    if (url) {
      if(title=='设备台账管理'){
        if(comID==171){
          wx.navigateTo({
            url: url,
          });
        }else{
          wx.showToast({
            title:"暂无权限",
            icon:'error'
          })
        }
      }else{
        wx.navigateTo({
          url: url,
        });
      }
    } else {
      wx.showToast({
        title: "开发中...",
        icon: "error",
      });
    }
  },
  updateList(){
    const comID = wx.getStorageSync("userInfo").data.comID;
    const position = wx.getStorageSync("userInfo").data.position
    if(position!='管家'){
        this.setData({
            'list[0].item[0].url':'/subpackagesA/pages/orderManagementZR/orderManagementZR'
        })
    }
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.setData({
      comID: wx.getStorageSync("userInfo").data.comID,
    });
    this.updateList()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {},

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {},
});
